package net.cyndeline.GUI.canvas

import javafx.scene.canvas.Canvas
import javafx.scene.image.Image

/**
 * Draws map-graphics onto a canvas.
 */
trait Painter {
  private var tileWidth = 4
  private var tileHeight = 4
  
  /**
   * Specifies which color should be used when drawing the next background,
   * using RGB values. Default value is black (0, 0, 0)
   */
  def setBackgroundColor(r: Int, g: Int, b: Int)
  
  /**
   * Specifies which color should be used when drawing the next text
   * string, using RGB values. Default value is white (255, 255, 255)
   */
  def setTextColor(r: Int, g: Int, b: Int)
  
  /**
   * Specifies text size.
   */
  def setTextSize(size: Int)
  
  /**
   * Specifies a canvas to draw on.
   */
  def setCanvas(canvas: Canvas)
  
  /**
   * Makes the canvas blank.
   */
  def clear()
  
  /**
   * Draws a rectangle on the canvas.
   * 
   * @param width Width of the rectangle.
   * @param height Height of the rectangle.
   * @param startX Upper left corner X coordinate of the rectangle on the canvas.
   * @param startY upper left corner Y coordinate of the rectangle on the canvas.
   * @param alpha Optional value between 0 and 1.0. Sets the transparency level
   * 			  of the rectangle.
   */
  def drawRectangle(width: Double, height: Double, startX: Int, startY: Int, alpha: Double = 1.0)
  
  /**
   * Draws an image onto the canvas, resizing it if needed to fit within
   * the width/height area specified (use image size to draw it unmodified).
   * 
   * @param img The image to draw.
   * @param width Width that the image should have when drawn.
   * @param height Height that the image should have when drawn. 
   */
  def drawImage(img: Image, startX: Double, startY: Double)
  
  /**
   * Draws a string of text onto the canvas.
   */
  def printText(str: String, startX: Int, startY: Int)
  
}